package cn.lsnu.modules.calculation;

import cn.lsnu.common.sys.entity.MenuEntity;
import cn.lsnu.common.sys.service.MenuService;
import cn.lsnu.utils.Global;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping({"/watchchart"})
public class WatchChart {

    @Autowired
    private MenuService menuService;

    @RequestMapping({"/list"})
    public
    String List(MenuEntity entity, Model model, HttpSession session) throws Exception{
        String firstTitle = entity.getFirstTitle();
        //每个-list页面的id
        model.addAttribute("pageId",entity.getMenuId());
        //获取页面的所有信息
        String userCode = (String) session.getAttribute(Global.SESSION_ID);
        entity.setUserCode(userCode);
        entity = menuService.getPageMenu(entity);
        entity.setFirstTitle(firstTitle);
        entity.setSecondTitle("抄表信息列表");
        model.addAttribute("pageMenuMsg",entity);
        return "webpage/modules/calculation/watch-chart";
    }
}
